<script setup>
const props = defineProps({
  text: {
    default: ''
  },
  bg: {
    default: ''
  }
})
</script>

<template>
  <div class="goods-box">
    <slot></slot>
    <div class="tag" v-if="props.text">
      <span :style="{backgroundColor: props.bg}">{{props.text}}</span>
    </div>
  </div>

</template>

<style lang="scss">
  .goods-box{
    position: relative;




    .tag{
      position: absolute;
      width: 100%;
      height: 24px;
      line-height: 24px;
      left: 0;
      top: 0;

      text-align: center;
      color: #fff;
      span{
        padding: 5px 10px;
      }
      
    }
  }
</style>
